import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../../routers/application.dart';

class Floor extends StatelessWidget {
  final String floorTitlePic;
  final List floorList;

  const Floor({Key key, this.floorTitlePic, this.floorList}) : super(key: key);

  Widget _buildTitle() {
    return Container(
        padding: EdgeInsets.all(8.0), child: Image.network(floorTitlePic));
  }

  Widget _buildItem(context,item) {
    return Container(
      width: ScreenUtil().setWidth(375),
      child: InkWell(
          onTap: () {
            // print('点击了楼层商品...');
            Application.router.navigateTo(context, '/detail?id=${item['goodsId']}');
          },
          child: Image.network(item['image'])),
    );
  }

  Widget _buildFirstRow(context) {
    return Row(
      children: <Widget>[
        _buildItem(context,floorList[0]),
        Column(
          children: <Widget>[
            _buildItem(context,floorList[1]),
            _buildItem(context,floorList[2])
          ],
        )
      ],
    );
  }

  Widget _buildSecondRow(context) {
    return Row(
      children: <Widget>[
        _buildItem(context,floorList[3]),
        _buildItem(context,floorList[4])
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[_buildTitle(), _buildFirstRow(context)],
      ),
    );
  }
}
